Skip to content

Make strict dropCR behavior optional via ParseOptions#78

Open
EmmanuelAC1 wants to merge 4 commits intosourcegraph:masterfrom
EmmanuelAC1:feature/optional-crlf
Open

Make strict dropCR behavior optional via ParseOptions#78
EmmanuelAC1 wants to merge 4 commits intosourcegraph:masterfrom
EmmanuelAC1:feature/optional-crlf

Conversation

@EmmanuelAC1
Copy link

Currently, the library strictly drops all trailing carriage returns (\r) from lines. This change introduces a mechanism to optionally preserve them while maintaining backward compatibility.

Detail:

  • Introduce ParseOptions struct with a KeepCR field.
  • Add *Options variants for [ParseMultiFileDiff], ParseHunks, and their corresponding New*Reader constructors.
  • Update lineReader and readLine to respect the KeepCR option.
  • Maintain existing function signatures as wrappers that default to KeepCR: false, ensuring no breaking changes for current users.
  • Add unit tests to verify KeepCR behavior.

@EmmanuelAC1 EmmanuelAC1 marked this pull request as ready for review February 12, 2026 14:08
@EmmanuelAC1
Copy link
Author

Hi @keegancsmith! I created this PR to make the dropCR behavior optional but keeping current behavior by default for backward compatibility. I'm not able to assign reviewers myself. Could you help guide me on how to get this reviewed?

@keegancsmith keegancsmith self-requested a review February 12, 2026 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant